//
//  MemberStatisticViewController.m
//  Rail
//
//  Created by hychen on 2018/3/5.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#import "MemberStatisticViewController.h"
#import "MJCSegmentInterface.h"
#import "MemberSubViewController.h"

@interface MemberStatisticViewController ()
@property (nonatomic, assign) MemberStatisticType type;
@end

@implementation MemberStatisticViewController

- (instancetype)initWithType:(MemberStatisticType)type {
    if (self = [super init]) {
        _type = type;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.navigationItem addSimpleTitleView:@"人员统计"];

    MemberSubViewController *allVc = [MemberSubViewController new];
    allVc.type = MemberStatisticTypeAll;
    
    MemberSubViewController *onlineVc = [MemberSubViewController new];
    onlineVc.type = MemberStatisticTypeOnline;
    MemberSubViewController *workVc = [MemberSubViewController new];
    workVc.type = MemberStatisticTypeWork;
    MemberSubViewController *observerVc = [MemberSubViewController new];
    observerVc.type = MemberStatisticTypeObserver;
    MemberSubViewController *manageVc = [MemberSubViewController new];
    manageVc.type = MemberStatisticTypeManage;
    MemberSubViewController *ownVc = [MemberSubViewController new];
    ownVc.type = MemberStatisticTypeOwner;
    MemberSubViewController *otherVc = [MemberSubViewController new];
    otherVc.type = MemberStatisticTypeOther;
    
    allVc.areaId = self.areaId;
    onlineVc.areaId = self.areaId;
    workVc.areaId = self.areaId;
    observerVc.areaId = self.areaId;
    manageVc.areaId = self.areaId;
    ownVc.areaId = self.areaId;
    otherVc.areaId = self.areaId;
    
    NSArray *vcArray = @[allVc,onlineVc,workVc,observerVc,manageVc,ownVc,otherVc];
    NSArray *titleArray = @[@"全部",@"在线",@"施工",@"监理",@"管理",@"业主",@"其他"];
    
    MJCSegmentInterface *interface = [MJCSegmentInterface jc_initWithFrame:CGRectMake(0,0,self.view.jc_width, self.view.jc_height-kStatusBarAndNavBarHeight) interFaceStyleToolsBlock:^(MJCSegmentStylesTools *jc_tools) {
        jc_tools.
        jc_titlesViewFrame(CGRectMake(0, 0, self.view.jc_width, 40)).
        jc_childScollEnabled(YES).
        jc_itemBackColor([UIColor whiteColor]).
        jc_childScollAnimalEnabled(YES).
        jc_itemTextSelectedColor(Color_RGB(0, 193, 224)).
        jc_itemTextNormalColor(Color_RGB(130, 130, 130)).
        jc_itemTextFontSize(14).
        jc_indicatorStyles(MJCIndicatorItemTextStyle).
        jc_itemSelectedSegmentIndex(0).
        jc_indicatorColor(Color_RGB(0, 193, 224)).
        //默认选中
        jc_itemSelectedSegmentIndex(self.type).
        jc_indicatorHidden(NO);
    }];
    
    [self.view addSubview:interface];
    [interface intoTitlesArray:titleArray intoChildControllerArray:vcArray hostController:self];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
